package com.wbao.dianniu.manager;

import java.util.ArrayList;
import java.util.List;


/**
 * 活动小助手-数据变化管理
 * 
 * @author yejianjun
 *
 */
public class ActivityHelperManager {

	private static ActivityHelperManager instance;
	private List<IActivityHelperListener> mList;
	public interface IActivityHelperListener {
		void statusChanged(int activityId, int accountId, int status);
	}
	
	public static ActivityHelperManager getInstance(){
		if(null == instance){
			instance = new ActivityHelperManager();
		}
		return instance;
	}
	
	public ActivityHelperManager() {
		mList = new ArrayList<IActivityHelperListener>();
	}
	
	public void IsChanged(int activityId,int accountId, int status){
		for (int i = 0; i < mList.size(); i++) {
			mList.get(i).statusChanged(activityId, accountId, status);
		}
	}
	
	public void addListener(IActivityHelperListener list){
		if(null == mList){
			mList = new ArrayList<IActivityHelperListener>();
		}
		mList.add(list);
	}
	
	public void removeListener(IActivityHelperListener list){
		if(null != mList){
			mList.remove(list);
		}
	}
}
